package com.Test.service;
import java.sql.*;
public class article {
    private static final String DRIVER_NAME="com.mysql.jdbc.Driver";
    private static final String URL ="jdbc:mysql://localhost:3306/article";
    private static final String USER_NAME ="root";
    private static final String PASSWORD ="123456";

    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Connection connection = null;
        Class.forName(DRIVER_NAME);
        connection = DriverManager.getConnection(URL,USER_NAME,PASSWORD);

        String sql = "  SELECT * FROM article";
        PreparedStatement prst = connection.prepareStatement(sql);

        ResultSet rs = prst.executeQuery();
        while (rs.next()){
            String creat =rs.getString("creat");
            String update = rs.getString("update");
            Number artid = rs.getInt("artid");
            Number userid = rs.getInt("userid");
            String username = rs.getString("username");
            String title = rs.getString("title");
            String subtitle =rs.getString("subtitle");
            String arttype = rs.getString("arttype");
            String headimg = rs.getString("headimg");
            String content = rs.getString("content");
            Number likes = rs.getInt("likes");
            Number share = rs.getInt("share");
            Boolean Super= rs.getBoolean("super");
            System.out.println(update);
        }
        rs.close();
        prst.close();
        connection.close();
    }}

